package com.java01.apache.commons.io;

import java.io.File;

import org.apache.commons.io.FileUtils;
import org.apache.commons.io.LineIterator;

public class ReadFileToIterator {

	public static void main(String[] args) throws Exception {
		File file = new File("D:/word.txt");
		LineIterator it = FileUtils.lineIterator(file, "UTF-8");
		//LineIterator it = FileUtils.lineIterator(file, "BIG5");
		//LineIterator it = FileUtils.lineIterator(file, "GB2312");
		try {
			while (it.hasNext()) {
				String line = it.nextLine();
				System.out.println(">>"+line);
			}
		} finally {
			LineIterator.closeQuietly(it);
		}
	}
}
